<?php

// @formatter:off
/**
 * @file WCLangTranslationHolder.php
 * @author Alejandro Dario Simi
 * @date $Date: 2014-05-04 01:33:52 +0000 (Sun, 04 May 2014) $
 *
 * This file contains definition for 'WCLangTranslationHolder' class.
 *
 * $Id: WCLangTranslationHolder.php 111 2014-05-04 01:33:52Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/includes/holders/WCLangTranslationHolder.php $
 */
// @formatter:on

/**
 * @class WCLangTranslationHolder
 * This singleton class is the one in charge of managing all rules. It's purpose
 * is to concentrate all rules fetches in one place avoiding unneeded memory
 * allocation.
 *
 * By default, this class only loads basic information on creation, but no heavy
 * lists. Lists are loaded only where they are needed.
 */
class WCLangTranslationHolder extends WCHolderKeyword {
	/**
	 * @var string Class name of the objects to be held.
	 */
	protected $_PropertiesItemClass = "WCLangTranslation";
	/**
	 * @var string This is the prefix of every column on the table
	 * '%rules'.
	 */
	protected $_PropertiesPrefix = "ltr_";
	/**
	 * @var string This is the name of the table represented by WCLangTranslation
	 * objects. In this case, '%rules'.
	 */
	protected $_PropertiesTable = "lang_translations";
	//
	// Public methods.
	public function rebuild() {
		$stmt = null;
		$stmtId = __CLASS__."::".__FUNCTION__;
		if($this->_db->has($stmtId)) {
			$stmt = $this->_db->get($stmtId);
		} else {
			$query = "truncate table {$this->_dbprefix}{$this->_PropertiesTable}";

			$stmt = $this->_db->prepare($stmtId, $query);
		}

		$stmt->execute();
	}
}
